<template>
	<view class="content">
		<!-- 个人信息 -->
		<view class="info">
			<view class="item">
				<text class="left">微信名称</text>
				<text class="left-2">小鹿快跑</text>
			</view>
			<view class="item">
				<text class="left">姓名</text>
				<text class="left-2">小鹿快跑</text>
			</view>
			<view class="item">
				<text class="left"><text>手机号</text></text>
				<text class="left-2" v-if="userPhone">
					{{userPhone.substr(0,3)}}****{{userPhone.substr(7,4)}}
				</text>
				<button class="get" @tap="bindPhone">
					<text style="color: #333333;margin-right: 20rpx;">1213123123</text>
					<text class="userPhone" v-text="userPhone ? '解绑' : '绑定'"></text>
				</button>
			</view>
			
		</view>
	
		<!-- 确定按钮 -->
		<button class="btn_submit" @tap="submit">确定</button>
		
		<!-- 登录提示 -->
		<!-- <sign-in></sign-in> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userName: '',  //用户名称
				sexList: [  //性别选项
					{ id: 1, text: '男' },
					{ id: 0, text: '女' }
				],
				userSex: 1,  //性别
				userAge: '60后',  //年龄
				ageIndex: 0,  //age序号
				userPhone: '',  //手机号
				ageList: ['60后', '70后', '80后', '90后', '00后'],  //年龄数组
				identity: 'UserIdentity',  //身份标识前缀
				userIdentity: 'UserIdentity0',  //身份符号
				userIdentity2: '车主',  //身份文字
				identityIndex: 0,  //身份序号
				identityList: ['UserIdentity0', 'UserIdentity1', 'UserIdentity2'],  //身份标识数组
				identityList2: ['车主', '车队长', '司机'],  //身份文字数组
				driveLicense: '',  //驾驶证照片
				driveLicense2: 'http://img.etubang.com/group1/M00/00/40/rBCky15Xf1CADDCDAAG_JRpzk5o300.png',  //驾驶证照片(默认)
			}
		},
		onLoad() {
			// this.dataDefault();
		},
		methods: {
			bindPhone() {
				this.$navigateTo('/pages/user/bind')
			},
			//初始化数据
			dataDefault() {
				let info = JSON.parse(this.$store.state.userinfo);
				this.userName = info.userName;
				this.userSex = info.userSex ? info.userSex : 0;
				this.userAge = info.userAge ? info.userAge : '60后';
				this.userPhone = info.userPhone ? info.userPhone : '';
				this.ageIndex = this.ageList.findIndex(item => item === this.userAge);
				this.userIdentity = info.userIdentity ? info.userIdentity : 'UserIdentity0';
				this.identityIndex = this.identityList.findIndex(item => item === this.userIdentity);
				this.userIdentity2 = this.identityList2[this.identityIndex];
				this.driveLicense = info.driveLicense ? info.driveLicense : this.driveLicense2;
			},
		}
	}
</script>

<style lang="scss">
	/* 个人信息 */
	.info {
		width: 750rpx;
		padding: 0 30rpx;
		background-color: $color-white;
		.item {
			width: 100%;
			height: 100rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			border-bottom: 1rpx solid $color-list;
			.left {
				flex: 1;
				color: $color-grey;
			}
			.left-2 {
				color: $color-grey;
			}
			.xing {
				color: #DD524D;
				margin-left: 12rpx;
			}
			.int {
				flex: 1;
				margin-left: 40rpx;
				text-align: end;
			}
			.get {
				margin-left: 15rpx;
				font-size: 30rpx;
				color: $color-text-primary;
				background-color: rgba(255,255,255,0);
				.t1 {
					font-size: 26rpx;
					color: $color-grey-dark;
					text-decoration: underline;
				}
			}
			.sex {
				display: flex;
				flex-direction: row;
				align-items: center;
				margin-left: 54rpx;
				.text {
					margin-left: 22rpx;
				}
				.text.t1 {
					color: $color-text-primary;
				}
			}
		}
		.item:last-child {
			border-bottom: none;
		}
	}
	
	/* 上传驾驶证 */
	.upload {
		width: 750rpx;
		padding: 40rpx 0;
		margin-top: $spacing-col;
		background-color: $color-white;
		.title {
			margin-left: 30rpx;
		}
		.doview {
			width: 100%;
			margin-top: 40rpx;
			text-align: center;
			.img {
				width: 424rpx;
				height: 302rpx;
			}
		}
	}
	
	/* 确定按钮 */
	.btn_submit {
		position: fixed;
		bottom: 100rpx;
	}
</style>
